<?php
/**
 * Created by PhpStorm.
 * User: SATA
 * Date: 2017/8/17
 * Time: 14:12
 */

namespace app\common\validate;
use think\Validate;

class Teacher extends Validate
{
    protected $rule =[
        ['num','require|unique:Teacher|length:1,32','编号必须|编号已存在|编号长度1-32'],
        ['name','require|unique:Teacher|length:1,32','姓名必须|姓名已存在|姓名长度1-32'],
        ['tel','require|unique:Teacher','手机号必须|手机号已存在'],
        ['gender','require','性别必须'],
        ['photo','require','图片必须'],
        ['grade','require|max:32','年级必须|年级最大长度32'],
        ['subject','require|max:32','科目必须|科目最大长度32'],
        ['charge','require|elt:9999999999|lt:0','费用必须|费用不能大于9999999999|费用不能少于0'],
        ['profile','max:255','简介最多字数255'],
        ['front_state','require|in:0,1','是否首页显示必须|条件错误']
    ];

    protected $scene = array(
        'edit'=>'num,tel,gender,photo,grade,subject,charge,profile,front_state',//教师编辑场景
    );
}